<?php
function __autoload($classname){
	include './'.$classname.'.php';
}
$key = $_GET['key'];
$cite = new Cite();
$oldData = $cite->index();
//$oldData = file_get_contents("./db/msg.txt");
//
//$oldData = json_decode($oldData,true);
session_start();
if (!$_SESSION){
	echo '<script>if(confirm("请先登陆")){location.href="./Index.php";}</script>';
	exit();
}
if ($_SESSION!=$oldData[$key]['username']){
	echo '<script>if(confirm("对不起，只能修改自己的留言")){location.href="./Index.php";}</script>';
	exit();
}
$data = $oldData[$key];

// var_dump($data);

include './temp/edit.html';